'MeaMod Playme
'Developed by The MeaMod Group
'Copyright 2009 The MeaMod Group
'http://meamod.com
'by James Weston
'--------------------------------
Imports System.Runtime.InteropServices

Public Class frmSplashScreen
    <StructLayout(LayoutKind.Sequential)> _
Public Structure MARGINS
        Public cxLeftWidth As Integer
        Public cxRightWidth As Integer
        Public cyTopHeight As Integer
        Public cyButtomheight As Integer
    End Structure

    <DllImport("dwmapi.dll", CharSet:=CharSet.Auto)> _
    Public Shared Sub DwmExtendFrameIntoClientArea(ByVal hWnd As System.IntPtr, ByRef pMargins As MARGINS)
    End Sub

    <DllImport("dwmapi.dll", CharSet:=CharSet.Auto)> _
    Public Shared Sub DwmIsCompositionEnabled(ByRef IsIt As Boolean)
    End Sub

    Dim siteResponds As Boolean = False
    'TODO: This form can easily be set as the splash screen for the application by going to the "Application" tab
    '  of the Project Designer ("Properties" under the "Project" menu).

    Private Sub frmSplashScreen_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'My.Computer.Audio.Play(My.Resources.audWelcome, AudioPlayMode.BackgroundLoop)
        If My.Computer.Info.OSVersion < "6" Then
            Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedDialog
            Me.BackColor = System.Drawing.SystemColors.Control
        Else
            On Error Resume Next
            Dim margins As MARGINS = New MARGINS
            margins.cxLeftWidth = -1
            margins.cxRightWidth = -1
            margins.cyTopHeight = -1
            margins.cyButtomheight = -1

            If My.Computer.Info.OSVersion >= "6" Then

                Dim isit As Boolean = False

                DwmIsCompositionEnabled(isit)
                If isit Then
                    Me.BackColor = System.Drawing.Color.Black
                    ' If DWM is enabled, call the function that gives us glass, passing a reference to our inset Margins
                    DwmExtendFrameIntoClientArea(Me.Handle, margins)
                Else
                    Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedDialog
                    Me.BackColor = System.Drawing.SystemColors.Control
                End If
            End If
            'set all the four value -1 to apply glass effect to the whole window
            'set your own value to make specific part of the window glassy.
        End If
    End Sub
End Class
